{template 'public/header'}

{template 'public/comhead'}
<link rel="stylesheet" type="text/css" href="../addons/zh_tcwq/template/public/ygcsslist.css">

<style type="text/css">
    
    .ygform>a{margin-right: 20px;}
    .ygform>div{margin-right: 20px;padding-left: 30px;padding-right: 30px;}
    .rel{
        position: relative;
        overflow: hidden;
    }
    .ab{
        position: absolute;
    }
    .top_class_0{
        z-index: 0;
    }
    .top_class_1{
        z-index: 2;
        background: #ffb200;
        transform:rotate(-29deg);
        color: #333;
        left:-8px;
        top:18px;
        width: 122%;
    }
</style>
<ul class="nav nav-tabs">
  <span class="ygxian"></span>
    <div class="ygdangq">当前位置:</div>
 
 <li  {if $type=='wait'} class="active" {/if}><a href="{php echo $this->createWebUrl('ininformation',array('type'=>wait,'state'=>1));}">待审核</a></li>
 <li  {if $type=='ok'} class="active" {/if}><a href="{php echo $this->createWebUrl('ininformation',array('type'=>ok,'state'=>2));}">已确认</a></li>
 <li  {if $type=='no'} class="active" {/if}><a href="{php echo $this->createWebUrl('ininformation',array('type'=>no,'state'=>3));}">已拒绝</a></li>
 <li  {if $type=='all'} class="active" {/if}><a href="{php echo $this->createWebUrl('ininformation',array('type'=>all));}">全部帖子</a></li>
</ul>
<div class="row ygrow">
    <div class="col-lg-12">
        <form action="" method="get" class="col-md-4">
        <input type="hidden" name="c" value="site" />
          <input type="hidden" name="a" value="entry" />
          <input type="hidden" name="m" value="zh_tcwq" />
          <input type="hidden" name="do" value="ininformation" />
            <div class="input-group" style="width: 300px">
                <input type="text" name="keywords" class="form-control" placeholder="请输入帖子联系人名称/电话/内容">
                <span class="input-group-btn">
                    <input type="submit" class="btn btn-default" name="submit" value="查找"/>
                </span>
            </div>
            <input type="hidden" name="token" value="{$_W['token']}"/>
        </form>
         <form action="" method="get" class="col-md-4">
          <input type="hidden" name="c" value="site" />
          <input type="hidden" name="a" value="entry" />
          <input type="hidden" name="m" value="zh_tcwq" />
          <input type="hidden" name="do" value="ininformation" />
            <div class="input-group" style="width: 100px">
                {php echo tpl_form_field_daterange('time');}
                <span class="input-group-btn">
                    <input type="submit" class="btn btn-default" name="submit2" value="查找"/>
                     <input type="hidden" name="token" value="{$_W['token']}"/>
                </span>
            </div><!-- /input-group -->
        </form>
                <form action="" method="get" class="col-md-2">
            <div class="input-group" style="width: 100px">
             
              <input type="hidden" name="c" value="site" />
            <input type="hidden" name="a" value="entry" />
            <input type="hidden" name="m" value="zh_tcwq" />
            <input type="hidden" name="do" value="ininformation" />
             <input type="hidden" name="top" value="1"/>
             <input type="hidden" name="type" value="all"/>
                <span class="input-group-btn">
                    <input type="submit" class="btn btn-default" name="submit3" value="置顶搜索"/>
                     <input type="hidden" name="token" value="{$_W['token']}"/>
                </span>
            </div><!-- /input-group -->
        </form>
        
        <input type="hidden" name="token" value="{$_W['token']}"/>
    </div><!-- /.col-lg-6 -->
</div>  
<div class="main">
    <div class="panel panel-default">
        <div class="panel-heading">
            帖子管理
        </div>
        <div class="panel-body" style="padding: 0px 15px;">
            <div class="row">
                <table class="yg5_tabel col-md-12">
                    <tr class="yg5_tr1">
                       <th class="store_td1 col-md-1" style="text-align: center;">
                          <input type="checkbox" class="allcheck" />
                          <span class="store_inp">全选</span>                      
                        </th>
                        <td class="col-md-1">发布时间</td>
                        <td class="col-md-1">发布人(id)</td>
                        <td class="col-md-1">发布人电话</td>
                        <td class="col-md-1">帖子简介</td>
                      <!--   <td class="col-md-1">是否热门</td> -->
                        <td class="col-md-1">是否置顶</td>                       
                         <td class="col-md-1">置顶期限</td>
                          <td class="store_td1 col-md-1">帖子id</td>
                        <td class="col-md-1">状态</td>
                        <td class="col-md-2">操作</td>
                    </tr>
                    {loop $list $key $item}
                    <tr class="yg5_tr2">
                        <td>
                          <input type="checkbox" name="test" value="{$item['id']}">
                        </td>
                   
                        <td>{php echo date("Y-m-d H:i:s",$item['time'])}</td>
                        <td>{$item['user_name']}（{$item['user_id']}）</td>
                        <td>{$item['user_tel']}</td>
                        <td class="rel">
                            {if $item['del']==1}
                            <div class="ab top_class_1" style="">用户已删除</div>
                            {/if}
                            <span class="top_class_0 rel">{php echo substr($item['details'],0,100)}</span>
                        </td>
                       <!--  <td>{if $item['hot']==1}<span class="label label-info">是</span>{else}否{/if}</td> -->
                        <td>{if $item['top']==1}<span class="label ygyouhui">是</span>{else}
                        <span class="label storegrey3">否</span>
                        {/if}</td>
                     
                          <td>{if $item['top_type']==1}一天{elseif $item['top_type']==2}一周{elseif $item['top_type']==3}一个月{/if}</td>
                            <td>{$item['id']}</td>
                          
                        {if $item['state']==1}
                        <td>
                            <span class="label storered">待审核</span>
                        </td >
                        {elseif $item['state']==2}
                        <td >
                            <span class="label storeblue">已通过</span>
                        </td>
                        {elseif $item['state']==3}
                        <td>
                           <span class="label storegrey">已拒绝</span>
                       </td>
                       {/if} 
                       <td>
                       {if $item['state']==1}
 <a href="{php echo $this->createWebUrl('ininformation',array('op'=>'tg','id'=>$item['id'],'type'=>$_GPC['type'],'page'=>$_GPC['page']));}"><button class="btn btn-xs storesuccess" style="background-color: white;">通过</button></a>
 <a href="{php echo $this->createWebUrl('ininformation',array('op'=>'jj','id'=>$item['id'],'type'=>$_GPC['type'],'page'=>$_GPC['page']));}"><button class="btn btn-xs storewarning" style="background-color: white;">拒绝</button></a>
                           {/if}
                          <a href="{php echo $this->createWebUrl('ininformationinfo',array('id'=>$item['id'],'type'=>$_GPC['type'],'page'=>$_GPC['page']));}" class="storespan btn btn-xs">
                                <span class="fa fa-pencil"></span>
                                <span class="bianji">查看
                                    <span class="arrowdown"></span>
                                </span>
                            
                            </a>
                           <a href="javascript:void(0);" class="storespan btn btn-xs" data-toggle="modal" data-target="#myModal{$item['id']}">
                               <span class="fa fa-trash-o"></span>
                               <span class="bianji">删除
                                    <span class="arrowdown"></span>
                                </span>
                           </a>
                           
                       </td>

                   </tr>
                   <div class="modal fade" id="myModal{$item['id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel" style="font-size: 20px;">提示</h4>
                        </div>
                        <div class="modal-body" style="font-size: 20px">
                            确定删除么？
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <a href="{php echo $this->createWebUrl('ininformation', array('op' => 'delete', 'id' => $item['id'],'type'=>$_GPC['type'],'page'=>$_GPC['page']))}" type="button" class="btn btn-info" >确定</a>
                        </div>
                    </div>
                </div>
            </div>
            {/loop}
            {if empty($list)}
            <tr class="yg5_tr2">
            <td colspan="12">
                  暂无帖子信息
              </td>
          </tr>
          {/if}
      </table>
  </div>
</div>
</div>
</div>
<div class="text-right we7-margin-top">
   {$pager}
</div>
<script type="text/javascript">
    $(function(){
        $("#frame-1").show();
        $("#yframe-1").addClass("wyactive");
        // ———————————————批量删除———————————————
        $("#allselect").on('click',function(){
            var check = $("input[type=checkbox][class!=allcheck]:checked");
            if(check.length < 1){
                alert('请选择要删除的用户!');
                return false;
            }else if(confirm("确认要删除此用户?")){
                var id = new Array();
                check.each(function(i){
                    id[i] = $(this).val();
                });
                console.log(id)
                $.ajax({
                    type:"post",
                    url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=alldeleteinfo&m=zh_tcwq",
                    dataType:"text",
                    data:{id:id},
                    success:function(data){
                        console.log(data);      
                       location.reload();
                    }
                })
               
            }
        });

        // ———————————————批量通过———————————————
        $("#allpass").on('click',function(){
            var check = $("input[type=checkbox][class!=allcheck]:checked");
            if(check.length < 1){
                alert('请选择要通过的帖子!');
                return false;
            }else if(confirm("确认要通过此帖子?")){
                var id = new Array();
                check.each(function(i){
                    id[i] = $(this).val();
                });
                console.log(id)
                $.ajax({
                    type:"post",
                    url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=AdoptInfo&m=zh_tcwq",
                    dataType:"text",
                    data:{id:id},
                    success:function(data){
                        console.log(data);      
                       location.reload();
                    }
                })               
            }
        });

        // ———————————————批量拒绝———————————————
        $("#allrefuse").on('click',function(){
            var check = $("input[type=checkbox][class!=allcheck]:checked");
            if(check.length < 1){
                alert('请选择要拒绝的帖子!');
                return false;
            }else if(confirm("确认要拒绝此帖子?")){
                var id = new Array();
                check.each(function(i){
                    id[i] = $(this).val();
                });
                console.log(id)
                $.ajax({
                    type:"post",
                    url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=RejectInfo&m=zh_tcwq",
                    dataType:"text",
                    data:{id:id},
                    success:function(data){
                        console.log(data);      
                       location.reload();
                    }
                })               
            }
        });

        $(".allcheck").on('click',function(){
            var checked = $(this).get(0).checked;
            $("input[type=checkbox]").prop("checked",checked);
        });
        
    })
</script>
{template 'common/footer'}